

import requests
import re
import os

comp1 = re.compile(r'lineIndex] \+ "(?P<url>.*?)"',re.S)
url =  "https://www.91kanju.com/vod-play/56169-1-1.html"
resp = requests.get(url)
txt1 = comp1.search(resp.text)
url2 = txt1.group("url")

resp2 = requests.get(url2)
print(resp2.text)
m3 = resp2.text
with open("v.m3u8", mode="wb") as f1:
    f1.write(resp2.content)

count = 0;
with open("v.m3u8",mode="r",encoding="utf-8") as f:
    for line in f:
        line.strip()
        if line.startswith("#"):
            continue
        print(line)
        resp_line = requests.get(line)
        with open(f"video/ts{count}.ts",mode="wb")as fl:
            fl.write(resp_line.content)
        count += 1



# copy /b G:\yuanjun\pythonWork\auto\MyFirstPython\爬虫\test\video\*.ts   D:\new.mp4
